      FUNCTION LENGTH ( STRING )
C*
C*                  *******************************
C*                  *******************************
C*                  **                           **
C*                  **          LENGTH           **
C*                  **                           **
C*                  *******************************
C*                  *******************************
C*
C*     SUBPROGRAM :
C*          LENGTH
C*
C*     AUTHOR :
C*          ART RAGOSTA
C*          MS 207-5
C*          AMES RESEARCH CENTER
C*          MOFFETT FIELD, CA  94035
C*          (415) 694-5578
C*
C*     PURPOSE :
C*          RETURNS THE LENGTH OF A STRING WHERE LENGTH IS DEFINED
C*          TO BE THE LOCATION OF THE LAST NON-BLANK CHARACTER
C*          IN THE STRING.  RETURNS 0 FOR AN EMPTY STRING.
C*
C*     INPUT ARGUMENTS :
C*          STRING - THE STRING TO BE CHECKED
C*
C*     OUTPUT ARGUMENTS :
C*          LENGTH - THE LENGTH OF THE STRING
C*
C*     INTERNAL WORK AREAS :
C*          NONE
C*
C*     COMMON BLOCKS :
C*          NONE
C*
C*     FILE REFERENCES :
C*          NONE
C*
C*     DATA BASE ACCESS :
C*          NONE
C*
C*     SUBPROGRAM REFERENCES :
C*          NONE
C*
C*     ERROR PROCESSING :
C*          NONE
C*
C*     TRANSPORTABILITY LIMITATIONS :
C*          NONE
C*
C*     ASSUMPTIONS AND RESTRICTIONS :
C*          NONE
C*
C*     LANGUAGE AND COMPILER :
C*          ANSI FORTRAN 77
C*
C*     VERSION AND DATE :
C*          VERSION I.0     15-OCT-84
C*
C*     CHANGE HISTORY :
C*          15-OCT-84    INITIAL VERSION
C*
C***********************************************************************
C*
      CHARACTER *(*) STRING
C
      LENGTH = LEN(STRING)
10    IF (STRING(LENGTH:LENGTH) .EQ. ' ') THEN
         LENGTH = LENGTH-1
         IF ( LENGTH .GT. 0 )GO TO 10
      ENDIF
      RETURN
      END
C
C---END LENGTH
C
